<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>常见问题</title><link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; --title-bar-height:20px; }
.mac-os-11 { --title-bar-height:28px; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; tab-size: 4; }
iframe { margin: auto; }
a.url { word-break: break-all; }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 36px; }
#write.first-line-indent p { text-indent: 2em; }
#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0px; }
#write.first-line-indent li { margin-left: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap; }
.typora-export .task-list-item input { pointer-events: none; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  #write { padding-left: 20px; padding-right: 20px; }
  .CodeMirror-sizer { margin-left: 0px !important; }
  .CodeMirror-gutters { display: none !important; }
}
#write li > figure:last-child { margin-bottom: 0.5rem; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; image-orientation: from-image; }
button, input, select, textarea { color: inherit; font: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
p { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px; }
tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li blockquote { margin: 1rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures; }
  #write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  .typora-export #write { break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  .is-mac table { break-inside: avoid; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
#write.first-line-indent p > .md-image:only-child:not(.md-img-error) img { left: -2em; position: relative; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
.MathJax_ref { fill: currentcolor; }
[contenteditable="true"]:active, [contenteditable="true"]:focus, [contenteditable="false"]:active, [contenteditable="false"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.html-for-mac .inline-math-svg .MathJax_SVG { vertical-align: 0.2px; }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; overflow-y: hidden; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: var(--monospace); }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none 0s ease 0s; }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important; margin-top: 0px !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; height: auto; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }
mark { background: rgb(255, 255, 0); color: rgb(0, 0, 0); }
.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit; }
mark .md-meta { color: rgb(0, 0, 0); opacity: 0.3 !important; }
@media print {
  .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid; }
}
.md-diagram-panel .messageText { stroke: none !important; }
.md-diagram-panel .start-state { fill: var(--node-fill); }
.md-diagram-panel .edgeLabel rect { opacity: 1 !important; }
.md-require-zoom-fix foreignobject { font-size: var(--mermaid-font-zoom); }


.CodeMirror { height: auto; }
.CodeMirror.cm-s-inner { background: inherit; }
.CodeMirror-scroll { overflow: auto hidden; z-index: 3; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: red; }
.cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; box-sizing: content-box; background: inherit; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; overflow-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { overflow-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}


:root {
    --side-bar-bg-color: #fafafa;
    --control-text-color: #777;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);

/* open-sans-regular - latin-ext_latin */
  /* open-sans-italic - latin-ext_latin */
    /* open-sans-700 - latin-ext_latin */
    /* open-sans-700italic - latin-ext_latin */
  html {
    font-size: 16px;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: rgb(51, 51, 51);
    line-height: 1.6;
}

#write {
    max-width: 860px;
  	margin: 0 auto;
  	padding: 30px;
    padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
	#write {
		max-width: 1024px;
	}
}

@media only screen and (min-width: 1800px) {
	#write {
		max-width: 1200px;
	}
}

#write > ul:first-child,
#write > ol:first-child{
    margin-top: 30px;
}

a {
    color: #4183C4;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
    text-decoration: none;
}
h1 tt,
h1 code {
    font-size: inherit;
}
h2 tt,
h2 code {
    font-size: inherit;
}
h3 tt,
h3 code {
    font-size: inherit;
}
h4 tt,
h4 code {
    font-size: inherit;
}
h5 tt,
h5 code {
    font-size: inherit;
}
h6 tt,
h6 code {
    font-size: inherit;
}
h1 {
    font-size: 2.25em;
    line-height: 1.2;
    border-bottom: 1px solid #eee;
}
h2 {
    font-size: 1.75em;
    line-height: 1.225;
    border-bottom: 1px solid #eee;
}

/*@media print {
    .typora-export h1,
    .typora-export h2 {
        border-bottom: none;
        padding-bottom: initial;
    }

    .typora-export h1::after,
    .typora-export h2::after {
        content: "";
        display: block;
        height: 100px;
        margin-top: -96px;
        border-top: 1px solid #eee;
    }
}*/

h3 {
    font-size: 1.5em;
    line-height: 1.43;
}
h4 {
    font-size: 1.25em;
}
h5 {
    font-size: 1em;
}
h6 {
   font-size: 1em;
    color: #777;
}
p,
blockquote,
ul,
ol,
dl,
table{
    margin: 0.8em 0;
}
li>ol,
li>ul {
    margin: 0 0;
}
hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
}

li p.first {
    display: inline-block;
}
ul,
ol {
    padding-left: 30px;
}
ul:first-child,
ol:first-child {
    margin-top: 0;
}
ul:last-child,
ol:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 15px;
    color: #777777;
}
blockquote blockquote {
    padding-right: 0;
}
table {
    padding: 0;
    word-break: initial;
}
table tr {
    border-top: 1px solid #dfe2e5;
    margin: 0;
    padding: 0;
}
table tr:nth-child(2n),
thead {
    background-color: #f8f8f8;
}
table th {
    font-weight: bold;
    border: 1px solid #dfe2e5;
    border-bottom: 0;
    margin: 0;
    padding: 6px 13px;
}
table td {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 6px 13px;
}
table th:first-child,
table td:first-child {
    margin-top: 0;
}
table th:last-child,
table td:last-child {
    margin-bottom: 0;
}

.CodeMirror-lines {
    padding-left: 4px;
}

.code-tooltip {
    box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
    border-top: 1px solid #eef2f2;
}

.md-fences,
code,
tt {
    border: 1px solid #e7eaed;
    background-color: #f8f8f8;
    border-radius: 3px;
    padding: 0;
    padding: 2px 4px 0px 4px;
    font-size: 0.9em;
}

code {
    background-color: #f3f4f4;
    padding: 0 2px 0 2px;
}

.md-fences {
    margin-bottom: 15px;
    margin-top: 15px;
    padding-top: 8px;
    padding-bottom: 6px;
}


.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
    html {
        font-size: 13px;
    }
    table,
    pre {
        page-break-inside: avoid;
    }
    pre {
        word-wrap: break-word;
    }
}

.md-fences {
	background-color: #f8f8f8;
}
#write pre.md-meta-block {
	padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f7f7f7;
    border: 0;
    border-radius: 3px;
    color: #777777;
    margin-top: 0 !important;
}

.mathjax-block>.code-tooltip {
	bottom: .375rem;
}

.md-mathjax-midline {
    background: #fafafa;
}

#write>h3.md-focus:before{
	left: -1.5625rem;
	top: .375rem;
}
#write>h4.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h5.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h6.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
.md-image>.md-meta {
    /*border: 1px solid #ddd;*/
    border-radius: 3px;
    padding: 2px 0px 0px 4px;
    font-size: 0.9em;
    color: inherit;
}

.md-tag {
    color: #a7a7a7;
    opacity: 1;
}

.md-toc { 
    margin-top:20px;
    padding-bottom:20px;
}

.sidebar-tabs {
    border-bottom: none;
}

#typora-quick-open {
    border: 1px solid #ddd;
    background-color: #f8f8f8;
}

#typora-quick-open-item {
    background-color: #FAFAFA;
    border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
    border-style: solid;
    border-width: 1px;
}

/** focus mode */
.on-focus-mode blockquote {
    border-left-color: rgba(85, 85, 85, 0.12);
}

header, .context-menu, .megamenu-content, footer{
    font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state{
    visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
    background-color: #fafafa;
    background-color: var(--side-bar-bg-color);
}

.md-lang {
    color: #b4654d;
}

.html-for-mac .context-menu {
    --item-hover-bg-color: #E6F0FE;
}

#md-notification .btn {
    border: 0;
}

.dropdown-menu .divider {
    border-color: #e5e5e5;
}

.ty-preferences .window-content {
    background-color: #fafafa;
}

.ty-preferences .nav-group-item.active {
    color: white;
    background: #999;
}

 :root {--mermaid-font-zoom:1.5em ;} 
</style>
</head>
<body class='typora-export os-windows'>
<div id='write'  class=''><h1><a name="css" class="md-header-anchor"></a><span>CSS</span></h1><p><span>Cascading Style Sheet 层叠样式表</span></p><h3><a name="css-选择器css选择器md" class="md-header-anchor"></a><a href='./CSS选择器.md'><span>CSS 选择器</span></a></h3><h3><a name="盒模型" class="md-header-anchor"></a><span>盒模型</span></h3><p><span>盒模型有两种， IE 怪异盒子模型、W3C 标准盒子模型；</span></p><p><span>盒模型是由： 内容(content)、内边距(padding)、边框(border)、外边距(margin) 组成的。</span></p><p><span>标准模型的宽高是指的 content 区宽高；</span>
<span>IE 盒模型的宽高是指的 content+padding+border 的宽高。</span></p><p><img src="../../img/stadardBox.png" referrerpolicy="no-referrer" alt="W3C盒模型"></p><p><img src="../../img/strangeBox.png" referrerpolicy="no-referrer" alt="IE盒模型"></p><h3><a name="css-如何设置这两种盒模型" class="md-header-anchor"></a><span>CSS 如何设置这两种盒模型？</span></h3><p><span>标准盒模型：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang=""><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang=""><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">box-sizing: content-box;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 23px;"></div><div class="CodeMirror-gutters" style="display: none; height: 23px;"></div></div></div></pre><p><span>怪异盒模型：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang=""><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang=""><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">box-sizing: border-box;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 23px;"></div><div class="CodeMirror-gutters" style="display: none; height: 23px;"></div></div></div></pre><h3><a name="bfc" class="md-header-anchor"></a><span>BFC</span></h3><p><a href='https://www.cnblogs.com/libin-1/p/7098468.html'><span>什么是 BFC</span></a></p><p><span>W3C 对 BFC 定义：</span></p><blockquote><p><span>浮动元素和绝对定位元素，非块级盒子的块级容器（例如 inline-blocks, table-cells, 和 table-captions），以及 overflow 值不为“visiable”的块级盒子，都会为他们的内容创建新的 BFC（块级格式上下文）。</span></p></blockquote><p><span>BFC(Block formatting context)直译为&quot;块级格式化上下文&quot;。它是一个独立的渲染区域，只有 Block-level box 参与， 它规定了内部的 Block-level Box 如何布局，并且与这个区域外部毫不相干。</span></p><p><span>BFC 作用：</span></p><ol start='' ><li><p><span>利用 BFC 避免外边距折叠</span></p></li><li><p><span>清除内部浮动 （撑开高度）</span></p><ol start='' ><li><span>原理: 触发父 div 的 BFC 属性，使下面的子 div 都处在父 div 的同一个 BFC 区域之内</span></li></ol></li><li><p><span>避免文字环绕</span></p></li><li><p><span>分属于不同的 BFC 时，可以阻止 margin 重叠</span></p></li><li><p><span>多列布局中使用 BFC</span></p></li></ol><p><span>如何生成 BFC：（脱离文档流，满足下列的任意一个或多个条件即可）</span></p><ol start='' ><li><span>根元素，即 HTML 元素（最大的一个 BFC）</span></li><li><span>float 的值不为 none</span></li><li><span>position 的值为 absolute 或 fixed</span></li><li><span>overflow 的值不为 visible（默认值。内容不会被修剪，会呈现在元素框之外）</span></li><li><span>display 的值为 inline-block、table-cell、table-caption</span></li></ol><p><span>BFC 布局规则：</span></p><ol start='' ><li><span>内部的 Box 会在垂直方向，一个接一个地放置。</span></li><li><span>属于同一个 BFC 的两个相邻的 Box 的 margin 会发生重叠</span></li><li><span>BFC 就是页面上的一个隔离的独立容器，容器里面的子元素不会影响到外面的元素。反之也如此, 文字环绕效果，设置 float</span></li><li><span>BFC 的区域不会与 float box 重叠。</span></li><li><span>计算 BFC 的高度，浮动元素也参与计算</span></li></ol><h3><a name="bfcifcgfc-和-ffc" class="md-header-anchor"></a><span>BFC、IFC、GFC 和 FFC</span></h3><ul><li><span>BFC（Block formatting contexts）：块级格式上下文</span></li><li><span>IFC（Inline formatting contexts）：内联格式上下文</span></li><li><span>GFC（GrideLayout formatting contexts）：网格布局格式化上下文</span></li><li><span>FFC（Flex formatting contexts）:自适应格式上下文</span></li></ul><h3><a name="非布局样式" class="md-header-anchor"></a><span>非布局样式</span></h3><ul><li><span>字体、字重、颜色、大小、行高</span></li><li><span>背景、边框</span></li><li><span>滚动、换行</span></li><li><span>粗体、斜体、下划线</span></li><li><span>其他</span></li></ul><h3><a name="行高的构成" class="md-header-anchor"></a><span>行高的构成</span></h3><ul><li><span>行高是由 line-box 组成的</span></li><li><span>line-box 是由一行里的 inline-box 组成的</span></li><li><span>inline-box 中最高的那个，或字体最大的拿个决定行高</span></li></ul><h3><a name="float" class="md-header-anchor"></a><span>float</span></h3><ul><li><span>元素&quot;浮动&quot;</span></li><li><span>脱离文档流</span></li><li><span>不脱离文本流</span></li><li><span>位置尽量靠上，并靠左或右</span></li></ul><p><span>对自己的影响</span></p><ul><li><span>形成&quot;块&quot;(BFC)</span></li><li><span>这个块会负责自己的布局，宽高由自己决定</span></li></ul><p><span>比如 span 中用 float 这个 span 就形成了一个 BFC，就可以设置宽高了</span></p><p><span>对兄弟元素的影响</span></p><ul><li><span>上面一般贴非 float 元素</span></li><li><span>靠边贴 float 元素或边</span></li><li><span>不影响其他块级元素位置</span></li><li><span>影响其他块级元素文本</span></li></ul><p><span>对父级元素的影响</span></p><ul><li><span>从布局上&quot;消失&quot;</span></li><li><span>高度塌陷</span></li></ul><h3><a name="清楚浮动" class="md-header-anchor"></a><span>清楚浮动</span></h3><p><span>浮动的元素布局时不会占据父元素的布局空间，即父元素布局时不会管浮动元素，浮动元素有可能超出父元素，从而对其他元素造成影响。</span></p><p><span>方法一：让父元素变为一个 BFC。</span>
<span>父元素 overflow: auto/hidden。 让父元素去关注里面的高度。</span>
<span>必须定义 width 或 zoom:1，同时不能定义 height，使用 overflow:auto 时，浏览器会自动检查浮动区域的高度</span></p><p><span>方法二： 使用伪元素清楚浮动</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-qualifier">.container</span>::<span class="cm-variable-3">after</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">content</span>: <span class="cm-string">" "</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">clear</span>: <span class="cm-atom">both</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">display</span>: <span class="cm-atom">block</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">visibility</span>: <span class="cm-atom">hidden</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">height</span>: <span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 159px;"></div><div class="CodeMirror-gutters" style="display: none; height: 159px;"></div></div></div></pre><h3><a name="inline-block-的间隙" class="md-header-anchor"></a><span>inline-block 的间隙</span></h3><p><span>两个并列的 inline-block 中间会有一条裂缝，这个的原因是两个标签之间有空格，浏览器把这些空格当成文字中空格，所以这两个块中间多少有间隙。</span></p><p><span>解决办法：</span></p><ol start='' ><li><span>删除两个标签间的空格，但是这样 html 排版不好</span></li><li><span>容器元素 font-size: 0 然后再在里面再重新设置字体大小</span></li></ol><h3><a name="你对-line-height-是如何理解的" class="md-header-anchor"></a><span>你对 line-height 是如何理解的？</span></h3><ul><li><span>line-height 指一行字的高度，包含了字间距，实际上是下一行基线到上一行基线距离</span></li><li><span>如果一个标签没有定义 height 属性，那么其最终表现的高度是由 line-height 决定的</span></li><li><span>一个容器没有设置高度，那么撑开容器高度的是 line-height 而不是容器内的文字内容</span></li><li><span>把 line-height 值设置为 height 一样大小的值可以实现单行文字的垂直居中</span></li><li><span>line-height 和 height 都能撑开一个高度，height 会触发 haslayout（一个低版本 IE 的东西），而 line-height 不会</span></li></ul><h3><a name="line-height-三种赋值方式有何区别带单位纯数字百分比）" class="md-header-anchor"></a><span>line-height 三种赋值方式有何区别？（带单位、纯数字、百分比）</span></h3><ul><li><span>带单位：px 是固定值，而 em 会参考父元素 font-size 值计算自身的行高</span></li><li><span>纯数字：会把比例传递给后代。例如，父级行高为 1.5，子元素字体为 18px，则子元素行高为 1.5 </span><span>*</span><span> 18 = 27px</span></li><li><span>百分比：将计算后的值传递给后代</span></li></ul><h3><a name="图片下面有一个缝隙是因为什么" class="md-header-anchor"></a><span>图片下面有一个缝隙是因为什么</span></h3><p><img src="../../img/imgbottom.png" referrerpolicy="no-referrer" alt="fenxi"></p><p><span>因为 img 也相当于一个 inline 的元素， inline 就要遵守行高的构成，它会按照 base 基线对齐，基线对齐的话那么它就会和底线间有一个缝隙。</span></p><p><span>如何解决： 因为它会遵守文字对齐方案，那么就把图片的对齐方式修改为 </span><code>vertical-align: bottom</code><span>。或者让他</span><code>display: block</code><span>，这样图片虽然会换行，但是没有间隙了。</span></p><h3><a name="边框" class="md-header-anchor"></a><span>边框</span></h3><ul><li><span>边框的属性： 线型、大小、颜色</span></li><li><span>边框背景图</span></li><li><span>边框衔接</span></li></ul><h3><a name="滚动" class="md-header-anchor"></a><span>滚动</span></h3><ul><li><span>visible 滚动条隐藏, 文字超出显示</span></li><li><span>hidden 滚动条隐藏, 文字超出不显示</span></li><li><span>scroll 滚动条一直显示，无论文字是否够多</span></li><li><span>auto 滚动条自动隐藏</span></li></ul><h3><a name="文字折行" class="md-header-anchor"></a><span>文字折行</span></h3><ul><li><p><span>overflow-wrap(word-wrap)通用换行控制</span></p><ul><li><span>是否保留单词</span></li></ul></li><li><p><span>word-break 针对多字节文本文字</span></p><ul><li><span>中文句子也是单词</span></li></ul></li><li><p><span>white-space 空白处是否换行</span></p></li></ul><h3><a name="装饰属性及其他" class="md-header-anchor"></a><span>装饰属性及其他</span></h3><ul><li><span>字重（粗体） font-weight</span></li><li><span>斜体 font-style: itatic</span></li><li><span>下划线 text-decoration</span></li><li><span>指针 cursor</span></li></ul><h3><a name="css-hack" class="md-header-anchor"></a><span>CSS Hack</span></h3><p><span>在一部分不合法，但是在某些浏览器上生效的写法就叫 CSS Hack，一般用来兼容老的浏览器， 缺点是难理解、难维护、易失效</span></p><p><span>替代方案：</span></p><ul><li><p><span>特征检测</span></p></li><li><p><span>针对性的加 class</span></p><ul><li><span>比如第一步检测是 IE6，那么只需要添加一个专门的 class 名来兼容 IE6 就好</span></li></ul></li></ul><p><span>写 Hack 时需要注意</span></p><ul><li><span>标准属性写在前面， hack 代码写在后面</span></li></ul><h3><a name="单行文本溢出显示省略号" class="md-header-anchor"></a><span>单行文本溢出显示省略号</span></h3><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">overflow</span>: <span class="cm-variable-3">hidden</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">text-overflow</span>: <span class="cm-variable-3">ellipsis</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">white-space</span>: <span class="cm-variable-3">no-wrap</span>;</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 68px;"></div><div class="CodeMirror-gutters" style="display: none; height: 68px;"></div></div></div></pre><h3><a name="多行文本溢出显示省略号" class="md-header-anchor"></a><span>多行文本溢出显示省略号</span></h3><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">overflow</span>: <span class="cm-variable-3">hidden</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">text-overflow</span>: <span class="cm-variable-3">ellipsis</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">display</span>: <span class="cm-meta">-webkit-</span><span class="cm-variable-3">box</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">-webkit-</span><span class="cm-tag">line-clamp</span>: <span class="cm-number">3</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">-webkit-</span><span class="cm-tag">box-orient</span>: <span class="cm-variable-3">vertical</span>;</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 113px;"></div><div class="CodeMirror-gutters" style="display: none; height: 113px;"></div></div></div></pre><h3><a name="div-中直接展示文字" class="md-header-anchor"></a><span>div 中直接展示文字</span></h3><p><span>div 中直接展示 textarea 的文字，要让文字不超出 DOM 边界，自动折行，而且保留原本在 textarea 中换行</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">div</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">white-space</span>: <span class="cm-atom">pre-line</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">word-break</span>: <span class="cm-atom">break-word</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 91px;"></div><div class="CodeMirror-gutters" style="display: none; height: 91px;"></div></div></div></pre><h3><a name="display-none-与-visibility-hidden-的区别" class="md-header-anchor"></a><span>display: none; 与 visibility: hidden; 的区别</span></h3><p><span>结构：</span></p><ul><li><p><span>display:none</span></p><ul><li><span>会让元素完全从渲染树中消失，渲染的时候不占据任何空间, 不能点击，</span></li></ul></li><li><p><span>visibility: hidden</span></p><ul><li><span>不会让元素从渲染树消失，渲染元素继续占据空间，只是内容不可见，不能点击</span></li></ul></li><li><p><span>opacity: 0</span></p><ul><li><span>不会让元素从渲染树消失，渲染元素继续占据空间，只是内容不可见，可以点击</span></li></ul></li></ul><p><span>继承</span></p><ul><li><p><span>display: none 和 opacity: 0</span></p><ul><li><span>非继承属性，子孙节点消失由于元素从渲染树消失造成，通过修改子孙节点属性无法显示。</span></li></ul></li><li><p><span>visibility: hidden</span></p><ul><li><span>继承属性，子孙节点消失由于继承了 hidden，通过设置 visibility: visible;可以让子孙节点显式。</span></li></ul></li></ul><p><span>性能</span></p><ul><li><p><span>display:none</span></p><ul><li><span>修改元素会造成文档回流。读屏器不会读取 display: none 元素内容，性能消耗较大</span></li></ul></li><li><p><span>visibility:hidden</span></p><ul><li><span>修改元素只会造成本元素的重绘,性能消耗较少。读屏器读取 visibility: hidden 元素内容</span></li></ul></li><li><p><span>opacity: 0</span></p><ul><li><span>修改元素会造成重绘，性能消耗较少</span></li></ul></li></ul><p><span>相同点： 它们都能让元素不可见、他们都依然可以被 JS 所获取到</span></p><h3><a name="外边距折叠collapsing-margins" class="md-header-anchor"></a><span>外边距折叠(collapsing margins)</span></h3><p><span>外边距重叠就是 margin-collapse</span></p><p><span>相邻的两个盒子（可能是兄弟关系也可能是祖先关系）的外边距可以结合成一个单独的外边距。 这种合并外边距的方式被称为折叠，结合而成的外边距称为折叠外边距</span></p><p><span>折叠结果遵循下列计算规则：</span></p><ul><li><span>两个相邻的外边距都是正数时，折叠结果是它们两者之间较大的值</span></li><li><span>两个相邻的外边距都是负数时，折叠结果是两者绝对值的较大值</span></li><li><span>两个外边距一正一负时，折叠结果是两者的相加的和</span></li></ul><p><span>新手在做导航栏的时候发现页面整体掉下来一截就是这个原因。</span></p><h3><a name="css-单位" class="md-header-anchor"></a><span>CSS 单位</span></h3><ol start='' ><li><p><span>px 绝对单位。传统上一个像素对应于计算机屏幕上的一个点，而对于高清屏则对应更多。</span></p></li><li><p><span>% 父元素</span><strong><span>宽度</span></strong><span>的比例。</span></p><ol start='' ><li><span>如果对 html 元素设置 font-size 为百分比值，则是以浏览器默认的字体大小 16px 为参照计算的（所有浏览器的默认字体大小都为 16px），如 62.5%即等于 10px（62.5% </span><span>*</span><span> 16px = 10px）。</span></li></ol></li><li><p><span>em 相对单位。 不同的属性有不同的参照值。</span></p><ol start='' ><li><span>对于字体大小属性（font-size）来说，em 的计算方式是相对于父元素的字体大小</span></li><li><span>border, width, height, padding, margin, line-height）在这些属性中，使用 em 单位的计算方式是参照该元素的 font-size，1em 等于该元素设置的字体大小。同理如果该元素没有设置，则一直向父级元素查找，直到找到，如果都没有设置大小，则使用浏览器默认的字体大小。</span></li></ol></li><li><p><span>rem 是相对于根元素 html 的 font-size 来计算的，所以其参照物是固定的。</span></p><ol start='' ><li><span>好处：rem 只需要修改 html 的 font-size 值即可达到全部的修改，即所谓的牵一发而动全身。</span></li></ol></li><li><p><span>vw, vh, vmin, vmax 相对单位，是基于视窗大小（浏览器用来显示内容的区域大小）来计算的。</span></p><ol start='' ><li><span>vw：基于视窗的宽度计算，1vw 等于视窗宽度的百分之一</span></li><li><span>vh：基于视窗的高度计算，1vh 等于视窗高度的百分之一</span></li><li><span>vmin：基于 vw 和 vh 中的最小值来计算，1vmin 等于最小值的百分之一</span></li><li><span>vmax：基于 vw 和 vh 中的最大值来计算，1vmax 等于最大值的百分之一</span></li></ol></li></ol><h3><a name="transform-变形httpsdevelopermozillaorgen-usdocswebcsstransform" class="md-header-anchor"></a><a href='https://developer.mozilla.org/en-US/docs/Web/CSS/transform'><span>transform 变形</span></a></h3><p><span>与 transition、translate 名字有点像，transition 是做过渡动画的，而 translate 是用来做平移的。</span></p><ul><li><p><span>none</span></p><ul><li><span>定义不进行转换。</span></li></ul></li><li><p><span>matrix(n,n,n,n,n,n)</span></p><ul><li><span>定义 2D 转换，使用六个值的矩阵。</span></li></ul></li><li><p><span>translate(x,y)</span></p><ul><li><span>从其当前位置移动，根据给定的 left（x 坐标）和 top（y 坐标）</span></li></ul></li><li><p><span>translate3d(x,y,z)</span></p><ul><li><span>定义 3D 转换。</span></li></ul></li><li><p><span>translateX(x)</span></p></li><li><p><span>translateY(y)</span></p></li><li><p><span>translateZ(z)</span></p></li><li><p><span>scale(x[,y]?)</span></p><ul><li><span>定义 2D 缩放转换。</span></li></ul></li><li><p><span>scale3d(x,y,z)</span></p><ul><li><span>定义 3D 缩放转换。</span></li></ul></li><li><p><span>scaleX(x)</span></p></li><li><p><span>scaleY(y)</span></p></li><li><p><span>scaleZ(z)</span></p></li><li><p><span>rotate(angle)</span></p><ul><li><span>定义 2D 旋转，在参数中规定角度。</span></li></ul></li><li><p><span>rotate3d(x,y,z,angle)</span></p><ul><li><span>定义 3D 旋转。</span></li></ul></li><li><p><span>rotateX(angle)</span></p></li><li><p><span>rotateY(angle)</span></p></li><li><p><span>rotateZ(angle)</span></p></li><li><p><span>skew(x-angle,y-angle)</span></p><ul><li><span>定义沿着 X 和 Y 轴的 2D 倾斜转换。</span></li></ul></li><li><p><span>skewX(angle)</span></p></li><li><p><span>skewY(angle)</span></p></li><li><p><span>perspective(n)</span></p><ul><li><span>为 3D 转换元素定义透视视图。</span></li></ul></li></ul><h3><a name="css-预处理器" class="md-header-anchor"></a><span>CSS 预处理器</span></h3><ul><li><p><span>嵌套</span></p><ul><li><span>反映层级和约束</span></li></ul></li><li><p><span>变量和计算</span></p><ul><li><span>减少冗余代码</span></li></ul></li><li><p><span>entend 和 mixin</span></p><ul><li><span>代码片段重用</span></li><li><span>mixin 是直接把 CSS 代码每个地方重复写一份</span></li><li><span>extend 是使用逗号分割的选择器来为多个不同的地方使用同一段 CSS</span></li></ul></li><li><p><span>循环</span></p><ul><li><span>适用于复杂有规律的样式</span></li></ul></li><li><p><span>import</span></p><ul><li><span>CSS 模块化</span></li></ul></li></ul><h3><a name="css-优化提高性能的方法有哪些" class="md-header-anchor"></a><span>CSS 优化、提高性能的方法有哪些？</span></h3><ul><li><p><span>多个 css 合并，尽量减少 HTTP 请求</span></p></li><li><p><span>css 雪碧图</span></p></li><li><p><span>抽象提取公共样式，减少代码量</span></p></li><li><p><span>选择器优化嵌套，尽量避免层级过深 （用‘&gt;’替换‘ ’）</span></p></li><li><p><span>属性值为 0 时，不加单位</span></p></li><li><p><span>压缩 CSS 代码</span></p></li><li><p><span>避免使用 </span><a href='http://www.divcss5.com/css3-style/c50224.shtml'><span>CSS 表达式</span></a></p><ul><li><span>它们要计算成千上万次并且可能会对你页面的性能产生影响。</span></li></ul></li></ul><h2><a name="dom-层级顺序与-z-indexhttpssegmentfaultcoma1190000014382426" class="md-header-anchor"></a><a href='https://segmentfault.com/a/1190000014382426'><span>DOM 层级顺序与 z-index</span></a></h2><h3><a name="link-与-import-的区别" class="md-header-anchor"></a><span>link 与 @import 的区别</span></h3><ul><li><span>link 是 HTML 方式， @import 是 CSS 方式</span></li><li><span>link 最大限度支持并行下载，@import 过多嵌套导致串行下载，出现 FOUC</span></li><li><span>link 可以通过 rel=&quot;alternate stylesheet&quot; 指定候选样式</span></li><li><span>浏览器对 link 支持早于@import ，可以使用 @import 对老浏览器隐藏样式</span></li><li><span>@import 必须在样式规则之前，可以在 css 文件中引用其他文件</span></li><li><span>总体来说：link 优于@import</span></li></ul><h3><a name="css-有哪些继承属性" class="md-header-anchor"></a><span>CSS 有哪些继承属性</span></h3><ul><li><p><span>关于文字排版的属性如：</span></p><ul><li><span>font</span></li><li><span>word-break</span></li><li><span>letter-spacing</span></li><li><span>text-align</span></li><li><span>text-rendering</span></li><li><span>word-spacing</span></li><li><span>white-space</span></li><li><span>text-indent</span></li><li><span>text-transform</span></li><li><span>text-shadow</span></li></ul></li><li><p><span>line-height</span></p></li><li><p><span>color</span></p></li><li><p><span>visibility</span></p></li><li><p><span>cursor</span></p></li></ul><h3><a name="display-有哪些值说明他们的作用" class="md-header-anchor"></a><span>display 有哪些值？说明他们的作用</span></h3><ul><li><span>block 像块类型元素一样显示。</span></li><li><span>none 将元素的显示设为无，即在网页中不占任何的位置。</span></li><li><span>inline 内联元素，元素前后没有换行符。</span></li><li><span>inline-block 象行内元素一样定位，但其内容象块类型元素一样显示。</span></li><li><span>list-item 象块类型元素一样显示，并添加样式列表标记。</span></li><li><span>table 此元素会作为块级表格来显示</span></li><li><span>inherit 规定应该从父元素继承 display 属性的值</span></li></ul><h3><a name="position-有哪些值-relative-和-absolute-定位原点是" class="md-header-anchor"></a><span>position 有哪些值？ relative 和 absolute 定位原点是？</span></h3><ul><li><span>absolute 生成绝对定位的元素，相对于值不为 static 的第一个父元素进行定位。</span></li><li><span>fixed （老 IE 不支持） 生成绝对定位的元素，相对于浏览器窗口进行定位。</span></li><li><span>relative 生成相对定位的元素，相对于其正常位置进行定位。</span></li><li><span>static 默认值。没有定位，元素出现在正常的流中（忽略 top, bottom, left, right - z-index 声明）。</span></li><li><span>inherit 规定从父元素继承 position 属性的值</span></li></ul><h3><a name="css3-新特性" class="md-header-anchor"></a><span>CSS3 新特性？</span></h3><ul><li><p><span>新增选择器 p:nth-child(n){color: rgba(255, 0, 0, 0.75)}</span></p></li><li><p><span>弹性盒模型 display: flex;</span></p></li><li><p><span>多列布局 column-count: 5;</span></p></li><li><p><span>媒体查询 @media (max-width: 480px) {.box: {column-count: 1;}}</span></p></li><li><p><span>个性化字体 @font-face{font-family: BorderWeb; src:url(BORDERW0.eot);}</span></p></li><li><p><span>颜色透明度 color: rgba(255, 0, 0, 0.75);</span></p></li><li><p><span>圆角 border-radius: 5px;</span></p></li><li><p><span>渐变 background:linear-gradient(red, green, blue);</span></p></li><li><p><span>阴影 box-shadow:3px 3px 3px rgba(0, 64, 128, 0.3);</span></p></li><li><p><span>倒影 box-reflect: below 2px;</span></p></li><li><p><span>文字装饰 text-stroke-color: red;</span></p></li><li><p><span>文字溢出 text-overflow:ellipsis;</span></p></li><li><p><span>背景效果 background-size: 100px 100px;</span></p></li><li><p><span>边框效果 border-image:url(bt_blue.png) 0 10;</span></p></li><li><p><span>平滑过渡 transition: all .3s ease-in .1s;</span></p></li><li><p><span>动画 @keyframes anim-1 {50% {border-radius: 50%;}} animation: anim-1 1s;</span></p></li><li><p><span>变形 transform</span></p><ul><li><span>旋转 transform: rotate(20deg);</span></li><li><span>倾斜 transform: skew(150deg, -10deg);</span></li><li><span>位移 transform: translate(20px, 20px);</span></li><li><span>缩放 transform: scale(.5);</span></li></ul></li></ul><h3><a name="如何水平居中一个元素" class="md-header-anchor"></a><span>如何水平居中一个元素？</span></h3><p><span>如果需要居中的元素为 inline 或 inline-block，为父元素设置 </span><code>text-align: center;</code><span>即可实现</span></p><p><span>如果要居中的元素为一个块级元素的话，一般使用 </span><code>margin: 0 auto;</code><span> 进行居中。</span></p><h3><a name="用纯-css-创建一个三角形的原理是什么" class="md-header-anchor"></a><span>用纯 CSS 创建一个三角形的原理是什么？</span></h3><p><span>把 border 的其他三条边设为透明</span>
<span>注意，这里要把 </span><code>border-width</code><span> 、</span><code>border-style</code><span>、 </span><code>border-color</code><span> 分开写。</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-qualifier">.tri</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">width</span>: <span class="cm-number">0px</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">height</span>: <span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">border-style</span>: <span class="cm-atom">solid</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">border-width</span>: <span class="cm-number">100px</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">border-color</span>: <span class="cm-atom">transparent</span> <span class="cm-atom">transparent</span> <span class="cm-keyword">red</span> <span class="cm-atom">transparent</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 159px;"></div><div class="CodeMirror-gutters" style="display: none; height: 159px;"></div></div></div></pre><h3><a name="li-与-li-之间有看不见的空白间隔是什么原因引起的有什么解决办法也称幽灵字符" class="md-header-anchor"></a><span>li 与 li 之间有看不见的空白间隔是什么原因引起的？有什么解决办法？(也称幽灵字符)</span></h3><p><span>行框的排列会受到中间空白（回车\空格）等的影响，因为空格也属于字符, 这些空白也会被应用样式，占据空间，所以会有间隔，把字符大小设为 0，就没有空格了</span></p><h3><a name="displayinline-block-什么时候会显示间隙携程" class="md-header-anchor"></a><span>display:inline-block 什么时候会显示间隙？(携程)</span></h3><ul><li><span>相邻的 inline-block 元素之间有换行或空格分隔的情况下会产生间距</span></li><li><span>非 inline-block 水平元素设置为 inline-block 也会有水平间距</span></li><li><span>可以借助 vertical-align:top; 消除垂直间隙</span></li><li><span>可以在父级加 font-size：0; 在子元素里设置需要的字体大小，消除垂直间隙</span></li><li><span>把 li 标签写到同一行可以消除垂直间隙，但代码可读性差</span></li></ul><h3><a name="什么是响应式设计响应式设计的基本原理是什么如何兼容低版本的-ie" class="md-header-anchor"></a><span>什么是响应式设计？响应式设计的基本原理是什么？如何兼容低版本的 IE？</span></h3><ul><li><span>响应式设计就是网站能够兼容多个不同大小的终端，而不是为每个终端做一个特定的版本</span></li><li><span>基本原理是利用 CSS3 媒体查询，为不同尺寸的设备适配不同样式</span></li><li><span>对于低版本的 IE，可采用 JS 获取屏幕宽度，然后通过监听 window.onresize 方法来实现兼容</span></li></ul><h3><a name="谈谈浮动和清除浮动" class="md-header-anchor"></a><span>谈谈浮动和清除浮动</span></h3><p><span>浮动的框可以向左或向右移动，</span><strong><span>直到他的外边缘碰到包含框或另一个浮动框的边框为止</span></strong><span>。 </span><strong><span>浮动框脱离文档流</span></strong><span>，所以文档的普通流的块框表现得就像浮动框不存在一样。浮动的块框会漂浮在文档普通流的块框上。</span></p><p><span>清除方法：</span></p><ol start='' ><li><span>父级 div 定义伪类：after 和 zoom (推荐使用，建议定义公共类，以减少 CSS 代码)</span></li></ol><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-qualifier">.clearfloat</span>:<span class="cm-variable-3">after</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">display</span>: <span class="cm-atom">block</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">clear</span>: <span class="cm-atom">both</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">content</span>: <span class="cm-string">""</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">visibility</span>: <span class="cm-atom">hidden</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">height</span>: <span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-qualifier">.clearfloat</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-string-2">zoom</span>: <span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 249px;"></div><div class="CodeMirror-gutters" style="display: none; height: 249px;"></div></div></div></pre><ol start='2' ><li><span>在结尾处添加空 div 标签 clear:both</span></li></ol><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="html" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="html"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">div</span> <span class="cm-attribute">class</span>=<span class="cm-string">"parent"</span><span class="cm-tag cm-bracket">&gt;</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">div</span> <span class="cm-attribute">class</span>=<span class="cm-string">"left"</span><span class="cm-tag cm-bracket">&gt;</span>Left<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">div</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">div</span> <span class="cm-attribute">class</span>=<span class="cm-string">"right"</span><span class="cm-tag cm-bracket">&gt;</span>Right<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">div</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">div</span> <span class="cm-attribute">class</span>=<span class="cm-string">"clearfloat"</span><span class="cm-tag cm-bracket">&gt;&lt;/</span><span class="cm-tag">div</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">div</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">style</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-qualifier">.left</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-property">float</span>: <span class="cm-atom">left</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-qualifier">.clearfloat</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-property">clear</span>: <span class="cm-atom">both</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">style</span><span class="cm-tag cm-bracket">&gt;</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 317px;"></div><div class="CodeMirror-gutters" style="display: none; height: 317px;"></div></div></div></pre><p><span>父级 div 定义 overflow:auto。 同时需要父级指定宽度</span></p><p><span>参考链接</span><a href='https://www.cnblogs.com/nxl0908/p/7245460.html'><span>几种常用的清除浮动方法</span></a></p><h3><a name="box-sizing-常用的属性有哪些分别有什么作用" class="md-header-anchor"></a><span>box-sizing 常用的属性有哪些？分别有什么作用？</span></h3><ul><li><span>box-sizing: content-box; // 默认的标准(W3C)盒模型元素效果</span></li><li><span>box-sizing: border-box; // 触发怪异(IE)盒模型元素的效果</span></li><li><span>box-sizing: inherit; // 继承父元素 box-sizing 属性的值</span></li></ul><h3><a name="请列举几种隐藏元素的方法" class="md-header-anchor"></a><span>请列举几种隐藏元素的方法</span></h3><ul><li><span>visibility: hidden; 这个属性只是简单的隐藏某个元素，但是元素占用的空间任然存在</span></li><li><span>opacity: 0; CSS3 属性，设置 0 可以使一个元素完全透明</span></li><li><span>position: absolute; 设置一个很大的 left 负值定位，使元素定位在可见区域之外</span></li><li><span>display: none; 元素会变得不可见，并且不会再占用文档的空间。</span></li><li><span>transform: scale(0); 将一个元素设置为缩放无限小，元素将不可见，元素原来所在的位置将被保留</span></li><li><span>&lt;</span><span>div hidden=&quot;hidden&quot;</span><span>&gt;</span><span> HTML5 属性,效果和 display:none;相同，但这个属性用于记录一个元素的状态</span></li><li><span>height: 0; 将元素高度设为 0 ，并消除边框</span></li><li><span>filter: blur(0); CSS3 属性，将一个元素的模糊度设置为 0</span></li></ul><h3><a name="rgba-和-opacity-的透明效果有什么不同" class="md-header-anchor"></a><span>rgba() 和 opacity 的透明效果有什么不同？</span></h3><ul><li><span>opacity 作用于元素以及元素内的所有内容（包括文字）的透明度</span></li><li><span>rgba() 只作用于元素自身的颜色或其背景色，子元素不会继承透明效果</span></li></ul><h3><a name="css-属性-content-有什么作用" class="md-header-anchor"></a><span>css 属性 content 有什么作用？</span></h3><p><span>content 属性专门应用在 before/after 伪元素上，用于插入额外内容或样式</span></p><h3><a name="元素竖向的百分比设定是相对于容器的高度吗" class="md-header-anchor"></a><span>元素竖向的百分比设定是相对于容器的高度吗？</span></h3><p><span>元素竖向的百分比设定是相对于容器的宽度，而不是高度</span></p><h3><a name="a-标签上四个伪类的使用顺序是怎么样的" class="md-header-anchor"></a><span>a 标签上四个伪类的使用顺序是怎么样的？</span></h3><p><span>link &gt; visited &gt; hover &gt; active</span>
<span>简称 lvha(love-ha)</span></p><p><span>伪类的特殊性（应用优先级）是同样的，所以后出现的伪类会覆盖先出现的伪类（同时激活）</span></p><p><span>在这里，比如把 hover 放在 active 后面，那么实际你在激活（active）链接的时候就触发了 hover 伪类，hover 在后面覆盖了 active 的颜色，所以始终无法看到 active 的颜色</span></p><h3><a name="伪元素和伪类的区别和作用" class="md-header-anchor"></a><span>伪元素和伪类的区别和作用？</span></h3><p><span>伪元素:在内容元素的前后插入额外的元素或样式，但是这些元素实际上并不在文档中生成。它们只在外部显示可见，但不会在文档的源代码中找到它们，因此，称为“伪”元素。例如：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">p</span>::<span class="cm-variable-3">before</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">content</span>: <span class="cm-string">"第一章："</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">p</span>::<span class="cm-variable-3">after</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">content</span>: <span class="cm-string">"Hot!"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">p</span>::<span class="cm-variable-3">first-line</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">background</span>: <span class="cm-keyword">red</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">p</span>::<span class="cm-variable-3">first-letter</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">font-size</span>: <span class="cm-number">30px</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 272px;"></div><div class="CodeMirror-gutters" style="display: none; height: 272px;"></div></div></div></pre><p><span>伪类: 将特殊的效果添加到特定选择器上。它是已有元素上添加类别的，不会产生新的元素。例如：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="css"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="css"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">a</span>:<span class="cm-variable-3">hover</span> {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">color</span>: <span class="cm-atom">#ff00ff</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag">p</span>:<span class="cm-variable-3">first-child</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-property">color</span>: <span class="cm-keyword">red</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 136px;"></div><div class="CodeMirror-gutters" style="display: none; height: 136px;"></div></div></div></pre><h3><a name="before-和-after-中双冒号和单冒号有什么区别" class="md-header-anchor"></a><span>::before 和 :after 中双冒号和单冒号有什么区别？</span></h3><ul><li><span>在 CSS 中伪类一直用 : 表示，如 :hover, :active 等</span></li><li><span>伪元素在 CSS1 中已存在，当时语法是用 : 表示，如 :before 和 :after</span></li><li><span>后来在 CSS3 中修订，伪元素用 :: 表示，如 ::before 和 ::after，以此区分伪元素和伪类</span></li><li><span>由于低版本 IE 对双冒号不兼容，开发者为了兼容性各浏览器，继续使使用 :after 这种老语法表示伪元素</span></li><li><span>综上所述：::before 是 CSS3 中写伪元素的新语法； :after 是 CSS1 中存在的、兼容 IE 的老语法</span></li></ul><h3><a name="设置元素浮动后该元素的-display-值会如何变化" class="md-header-anchor"></a><span>设置元素浮动后，该元素的 display 值会如何变化？</span></h3><p><span>设置元素浮动后，该元素的 display 值自动变成 block</span></p><h3><a name="请解释-css-sprites以及你要如何在页面或网站中实现它" class="md-header-anchor"></a><span>请解释 CSS sprites，以及你要如何在页面或网站中实现它</span></h3><ul><li><span>CSS Sprites 其实就是把网页中一些背景图片整合到一张图片文件中，再利用 CSS 的“background-image”，“background- repeat”，“background-position”的组合进行背景定位，background-position 可以用数字能精确的定位出背景图片的位置。</span></li><li><span>CSS Sprites 为一些大型的网站节约了带宽，让提高了用户的加载速度和用户体验，不需要加载更多的图片。</span></li></ul><h3><a name="base64-的使用" class="md-header-anchor"></a><span>base64 的使用</span></h3><ul><li><span>写入 CSS， 减少 HTTP 请求</span></li><li><span>适用于小图片</span></li><li><span>base64 的体积约为原图 4/3</span></li></ul><h3><a name="margin-叠加几种情况" class="md-header-anchor"></a><span>margin 叠加几种情况</span></h3><p><span>margin 叠加的意思是：当两个或者更多的垂直外边距 相遇时，它们将形成一个外边距，这个外边距的高度等于两个发生叠加的外边距中高度较大者。</span></p><ol start='' ><li><span>当一个元素出现在另一个元素上面时，第一个元素的底边外边距与第二个元素的顶边外边距发生叠加。如图：</span>
<img src="../../img/marginSuperposition1.png" referrerpolicy="no-referrer" alt="叠加"></li><li><span>当一个元素在另一个元素中时，它们的顶边距和低边距也会发生叠加</span>
<img src="../../img/marginSuperposition2.png" referrerpolicy="no-referrer" alt="叠加2"></li><li><span>如果一个元素是空元素（即一个元素没有内容，内边距和边框），这种情况外边距的顶边距和低边距碰在一起也会发生叠加</span>
<img src="../../img/marginSuperposition3.png" referrerpolicy="no-referrer" alt="叠加3"></li><li><span>在上面那种空元素的情况，如果该空元素与另一个元素的外边距碰在一起，也会发生叠加。</span>
<img src="../../img/marginSuperposition4.png" referrerpolicy="no-referrer" alt="叠加4"></li></ol><p><span>以上 4 种外边距叠加情况</span><strong><span>只会发生在普通文档流的垂直方向</span></strong><span>。行内框、浮动框、绝对定位框之间的外边距不会发生叠加，同样水平方向也不会发生叠加。</span></p></div>
</body>
</html>